

#ifndef ORGANIZATIONAO_STRUCT_H
#define ORGANIZATIONAO_STRUCT_H

#include <stdint.h>
#include <string>
#include <iostream>
#include "libc2c/byte_stream.h"
#include "app_platform/intf_service_object.h"
#include "erp/organization/po/organizationfilterpo_organization.h"	
#include <set>	
#include <map>	
#include <vector>	
#include "erp/organization/po/branchpo_organization.h"	

namespace erp
{
namespace organization
{
namespace ao
{

	const uint32_t ORGANIZATIONAO_DELETEBRANCH_REQ_CMD_ID = 0xC04D1802; /// 请求命令号
	const uint32_t ORGANIZATIONAO_DELETEBRANCH_RESP_CMD_ID = 0xC04D8802; /// 回应命令号
	

	const uint32_t ORGANIZATIONAO_FINDBRANCH_REQ_CMD_ID = 0xC04D1804; /// 请求命令号
	const uint32_t ORGANIZATIONAO_FINDBRANCH_RESP_CMD_ID = 0xC04D8804; /// 回应命令号
	

	const uint32_t ORGANIZATIONAO_GETBRANCH_REQ_CMD_ID = 0xC04D1803; /// 请求命令号
	const uint32_t ORGANIZATIONAO_GETBRANCH_RESP_CMD_ID = 0xC04D8803; /// 回应命令号
	

	const uint32_t ORGANIZATIONAO_MODIFYBRANCH_REQ_CMD_ID = 0xC04D1801; /// 请求命令号
	const uint32_t ORGANIZATIONAO_MODIFYBRANCH_RESP_CMD_ID = 0xC04D8801; /// 回应命令号
	


const uint16_t ORGANIZATIONAO_MAX_PROTOCAL_VERSION = 2; //>平台支持的最大协议版本号


///////////////////////////// STRUCTS /////////////////////////////////////////////////
	/**
	 *
 	 * 
	 *
 	 * @date 2013-10-23 11:04:16
 	 * @version 0
	 */	
	struct COrganizationAoDeleteBranchReq : public IServiceObject, public ISerializableXML
	{
		std::string machineKey;
		std::string source;
		uint32_t sceneId;
		uint32_t option;
		std::set<uint64_t > branchId;
		std::string inReserve;
		std::string errmsg;
		std::map<uint64_t,uint32_t > errorCode;
		std::map<uint64_t,std::string > errorMsg;
		std::string outReserve;
	
	    virtual uint32_t getCmdId() const { return ORGANIZATIONAO_DELETEBRANCH_REQ_CMD_ID; }
		virtual bool Serialize(CByteStreamNetwork& bs)
		{
			//检查协议的版本号
		    //if(bs.getVersion() > ORGANIZATIONAO_MAX_PROTOCAL_VERSION)
		    //    return false;
			bs & machineKey;
			bs & source;
			bs & sceneId;
			bs & option;
			bs & branchId;
			bs & inReserve;
		    return bs.isGood();
		}
		
	    virtual void Dump(std::ostream& os)	{}
	
		virtual bool FromXML(const std::string& sXMLContent) { return true; }
		virtual bool ToXML(std::string& sXMLContent) { return true; }
	};
	
	/**
	 *
 	 * 
	 *
 	 * @date 2013-10-23 11:04:16
 	 * @version 0
	 */	
	struct COrganizationAoDeleteBranchResp : public IServiceObject, public ISerializableXML
	{
		uint32_t dwResult;
		std::string errmsg;
		std::map<uint64_t,uint32_t > errorCode;
		std::map<uint64_t,std::string > errorMsg;
		std::string outReserve;
		
	    virtual uint32_t getCmdId() const { return ORGANIZATIONAO_DELETEBRANCH_RESP_CMD_ID; }
		virtual bool Serialize(CByteStreamNetwork& bs)
		{
		    bs & dwResult;
			bs & errmsg;
			bs & errorCode;
			bs & errorMsg;
			bs & outReserve;

		    return bs.isGood();
		}
	    virtual void Dump(std::ostream& os)	{}
	
		virtual bool FromXML(const std::string& sXMLContent) { return true; }
		virtual bool ToXML(std::string& sXMLContent) { return true; }
	};	
	/**
	 *
 	 * 
	 *
 	 * @date 2013-10-23 11:04:16
 	 * @version 0
	 */	
	struct COrganizationAoFindBranchReq : public IServiceObject, public ISerializableXML
	{
		std::string machineKey;
		std::string source;
		uint32_t sceneId;
		uint32_t option;
		erp::organization::po::COrganizationFilterPo filter;	
		std::string inReserve;
		std::string errmsg;
		uint32_t total;
		std::vector<erp::organization::po::CBranchPo > branch;
		std::string outReserve;
	
	    virtual uint32_t getCmdId() const { return ORGANIZATIONAO_FINDBRANCH_REQ_CMD_ID; }
		virtual bool Serialize(CByteStreamNetwork& bs)
		{
			//检查协议的版本号
		    //if(bs.getVersion() > ORGANIZATIONAO_MAX_PROTOCAL_VERSION)
		    //    return false;
			bs & machineKey;
			bs & source;
			bs & sceneId;
			bs & option;
			filter.Serialize(bs);
			bs & inReserve;
		    return bs.isGood();
		}
		
	    virtual void Dump(std::ostream& os)	{}
	
		virtual bool FromXML(const std::string& sXMLContent) { return true; }
		virtual bool ToXML(std::string& sXMLContent) { return true; }
	};
	
	/**
	 *
 	 * 
	 *
 	 * @date 2013-10-23 11:04:16
 	 * @version 0
	 */	
	struct COrganizationAoFindBranchResp : public IServiceObject, public ISerializableXML
	{
		uint32_t dwResult;
		std::string errmsg;
		uint32_t total;
		std::vector<erp::organization::po::CBranchPo > branch;
		std::string outReserve;
		
	    virtual uint32_t getCmdId() const { return ORGANIZATIONAO_FINDBRANCH_RESP_CMD_ID; }
		virtual bool Serialize(CByteStreamNetwork& bs)
		{
		    bs & dwResult;
			bs & errmsg;
			bs & total;
			bs & branch;
			bs & outReserve;

		    return bs.isGood();
		}
	    virtual void Dump(std::ostream& os)	{}
	
		virtual bool FromXML(const std::string& sXMLContent) { return true; }
		virtual bool ToXML(std::string& sXMLContent) { return true; }
	};	
	/**
	 *
 	 * 
	 *
 	 * @date 2013-10-23 11:04:16
 	 * @version 0
	 */	
	struct COrganizationAoGetBranchReq : public IServiceObject, public ISerializableXML
	{
		std::string machineKey;
		std::string source;
		uint32_t sceneId;
		uint32_t option;
		std::set<uint64_t > branchId;
		std::string inReserve;
		std::string errmsg;
		std::map<uint64_t,uint32_t > errorCode;
		std::map<uint64_t,std::string > errorMsg;
		std::map<uint64_t,erp::organization::po::CBranchPo > branch;
		std::string outReserve;
	
	    virtual uint32_t getCmdId() const { return ORGANIZATIONAO_GETBRANCH_REQ_CMD_ID; }
		virtual bool Serialize(CByteStreamNetwork& bs)
		{
			//检查协议的版本号
		    //if(bs.getVersion() > ORGANIZATIONAO_MAX_PROTOCAL_VERSION)
		    //    return false;
			bs & machineKey;
			bs & source;
			bs & sceneId;
			bs & option;
			bs & branchId;
			bs & inReserve;
		    return bs.isGood();
		}
		
	    virtual void Dump(std::ostream& os)	{}
	
		virtual bool FromXML(const std::string& sXMLContent) { return true; }
		virtual bool ToXML(std::string& sXMLContent) { return true; }
	};
	
	/**
	 *
 	 * 
	 *
 	 * @date 2013-10-23 11:04:16
 	 * @version 0
	 */	
	struct COrganizationAoGetBranchResp : public IServiceObject, public ISerializableXML
	{
		uint32_t dwResult;
		std::string errmsg;
		std::map<uint64_t,uint32_t > errorCode;
		std::map<uint64_t,std::string > errorMsg;
		std::map<uint64_t,erp::organization::po::CBranchPo > branch;
		std::string outReserve;
		
	    virtual uint32_t getCmdId() const { return ORGANIZATIONAO_GETBRANCH_RESP_CMD_ID; }
		virtual bool Serialize(CByteStreamNetwork& bs)
		{
		    bs & dwResult;
			bs & errmsg;
			bs & errorCode;
			bs & errorMsg;
			bs & branch;
			bs & outReserve;

		    return bs.isGood();
		}
	    virtual void Dump(std::ostream& os)	{}
	
		virtual bool FromXML(const std::string& sXMLContent) { return true; }
		virtual bool ToXML(std::string& sXMLContent) { return true; }
	};	
	/**
	 *
 	 * 
	 *
 	 * @date 2013-10-23 11:04:16
 	 * @version 0
	 */	
	struct COrganizationAoModifyBranchReq : public IServiceObject, public ISerializableXML
	{
		std::string machineKey;
		std::string source;
		uint32_t sceneId;
		uint32_t option;
		erp::organization::po::CBranchPo branch;	
		std::string inReserve;
		std::string errmsg;
		erp::organization::po::CBranchPo branchBack;	
		std::string outReserve;
	
	    virtual uint32_t getCmdId() const { return ORGANIZATIONAO_MODIFYBRANCH_REQ_CMD_ID; }
		virtual bool Serialize(CByteStreamNetwork& bs)
		{
			//检查协议的版本号
		    //if(bs.getVersion() > ORGANIZATIONAO_MAX_PROTOCAL_VERSION)
		    //    return false;
			bs & machineKey;
			bs & source;
			bs & sceneId;
			bs & option;
			branch.Serialize(bs);
			bs & inReserve;
		    return bs.isGood();
		}
		
	    virtual void Dump(std::ostream& os)	{}
	
		virtual bool FromXML(const std::string& sXMLContent) { return true; }
		virtual bool ToXML(std::string& sXMLContent) { return true; }
	};
	
	/**
	 *
 	 * 
	 *
 	 * @date 2013-10-23 11:04:16
 	 * @version 0
	 */	
	struct COrganizationAoModifyBranchResp : public IServiceObject, public ISerializableXML
	{
		uint32_t dwResult;
		std::string errmsg;
		erp::organization::po::CBranchPo branchBack;	
		std::string outReserve;
		
	    virtual uint32_t getCmdId() const { return ORGANIZATIONAO_MODIFYBRANCH_RESP_CMD_ID; }
		virtual bool Serialize(CByteStreamNetwork& bs)
		{
		    bs & dwResult;
			bs & errmsg;
			branchBack.Serialize(bs);
			bs & outReserve;

		    return bs.isGood();
		}
	    virtual void Dump(std::ostream& os)	{}
	
		virtual bool FromXML(const std::string& sXMLContent) { return true; }
		virtual bool ToXML(std::string& sXMLContent) { return true; }
	};	

}
}
}

#endif /* ORGANIZATIONAO_STRUCT_H */

